const express = require('express')
const router = express.Router()
const sendemail = require('../sendemail.js')
const schedule = require('node-schedule')
router.get('/sendemail', (req, res) => {
	const body = req.query
	console.log(body);
	const {
		title,
		content,
		qqemail,
	} = body
	console.log(title);
	
	schedule.scheduleJob('* * 9 * * *', function() {
		sendemail(title, content, qqemail)
	});
	res.send({
		msg: 1
	})
})
router.get('/time', (req, res) => {
	const num = req.query.num
	var a = schedule.scheduleJob('30 * * * * *', function() {
		console.log('num' + num + ':' + new Date());

	});
	res.send({
		msg: 1
	})
})
module.exports = router
